package server.business.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import server.business.pojo.Department;
import server.business.service.DepartmentService;
import server.business.mapper.DepartmentMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Galaxy
 * @description 针对表【department(科别)】的数据库操作Service实现
 * @createDate 2022-11-08 12:46:24
 */
@Service("departmentService")
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department>
        implements DepartmentService {
    //*************************************myq*************************start
    @Autowired
    private DepartmentMapper departmentMapper;

    @Override
    public List<Department> findChildByCode(String code) {
        LambdaQueryWrapper<Department> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Department::getParentCode, code);
        List<Department> list = departmentMapper.selectList(queryWrapper);
        return list;
    }

    @Override
    public List<Department> selectDepartmentByCode(String code) {
        LambdaQueryWrapper<Department> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Department::getParentCode, "0");
        List<Department> list = departmentMapper.selectList(queryWrapper);
        System.out.println(list);
        return list;
    }
    //*************************************myq*************************end
}




